package com.xaicode.template.gendata.mall.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Random;

/**
 * @author Locker xaicode@sina.com
 * @version 1.0
 * @date 2022/5/24 0024 21:45
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AppError {

    Integer error_code;
    String msg;

    public static AppError build() {
        int errorCode = getRandInt(1001, 4001);
        String msg = "Exception in thread";
        return new AppError(errorCode, msg);
    }

    static int getRandInt(int fromNum, int toNum) {
        return fromNum + (new Random()).nextInt(toNum - fromNum + 1);
    }

}
